package com.luli.Utils.easeExcel;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author: zjl
 * @datetime: 2024/3/30
 * @desc:
 */
@Getter
@AllArgsConstructor
public enum IsPaymentEnum {
    UNKNOWN(0,"其他"),
    ISNOTPAY(1, "未支付"),
    ISPAY(2, "已支付");

    private final Integer value;

    @JsonFormat
    private final String description;

    public static IsPaymentEnum convert(Integer value) {
        return Stream.of(values())
                .filter(bean -> bean.value.equals(value))
                .findAny()
                .orElse(UNKNOWN);
    }

    public static IsPaymentEnum convert(String description) {
        return Stream.of(values())
                .filter(bean -> bean.description.equals(description))
                .findAny()
                .orElse(UNKNOWN);
    }
}
